Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initializes service:bridge-relay command #4314

Merged
merged 5 commits into from
Sep 22, 2023

Conversation

hughy
Copy link
Contributor

@hughy hughy commented Sep 21, 2023

Summary

adds a service command to act as a relay; decrypting deposit transactions on Iron Fish and calling the bridge contract on Ethereum

relies on remote node to decrypt transactions with a given view key via chain/getTransactionStream

waits until block confirmed before processing deposit transactions

Testing Plan

manual testing:

  • created bridge account
  • ran relay with bridge account's incoming view key
  • sent deposit transaction to bridge account
image

Documentation

Does this change require any updates to the Iron Fish Docs (ex. the RPC API
Reference
)? If yes, link a
related documentation pull request for the website.

[ ] Yes

Breaking Change

Is this a breaking change? If yes, add notes below on why this is breaking and
what additional work is required, if any.

[ ] Yes

adds a service command to act as a relay; decrypting deposit transactions on
Iron Fish and calling the bridge contract on Ethereum

relies on remote node to decrypt transactions with a given view key via
chain/getTransactionStream

waits until block confirmed before processing deposit transactions
@hughy hughy requested a review from a team as a code owner September 21, 2023 18:43
}),
viewKey: Flags.string({
char: 'k',
description: 'View key to watch transactions with',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should label this as incoming view key, since we have the concept of a "view key" which has functionality of both ivk and ovk (see --export json)


const committing = buffer.length > confirmations

this.log(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is gonna be a lot of log lines, currently 220k, just fyi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this was just copied from the sync command

we can make this a debug-level log or remove it

for (const note of transaction.notes) {
this.log(`Processing deposit ${note.memo}, from transaction ${transaction.hash}`)
// TODO: get Eth deposit address from API
// TODO: call Eth bridge contract to mint
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if commit is being performed and process is killed. Then it was restarted, the head hash would be for a partially processed block? We could potentially reprocess notes right? Seems like not a big deal for prototyping, just keeping it in mind for external service calls during processing of chain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably need to store some status on the deposits -- if the process stops in the middle of a block then we don't want to reprocess deposits that we've already invoked the Eth contract for

viewKey and incomingViewKey are two different keys, so we should keep the terms
clear
changes 'service:bridge-relay' to 'service:bridge:relay'

we expect to implement at least one more bridge service command
@hughy hughy merged commit 1834d4b into bridge-prototype Sep 22, 2023
4 checks passed
@hughy hughy deleted the feat/hughy/ifl-1680/service-bridge-relay branch September 22, 2023 22:39
leanthebean pushed a commit that referenced this pull request Feb 5, 2024
* initializes service:bridge-relay command

adds a service command to act as a relay; decrypting deposit transactions on
Iron Fish and calling the bridge contract on Ethereum

relies on remote node to decrypt transactions with a given view key via
chain/getTransactionStream

waits until block confirmed before processing deposit transactions

* renames viewKey to incomingViewKey

viewKey and incomingViewKey are two different keys, so we should keep the terms
clear

* changes progress log to debug

* changes head arg to fromHead flag

* creates bridge sub-namespace in service commands

changes 'service:bridge-relay' to 'service:bridge:relay'

we expect to implement at least one more bridge service command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants